#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <assert.h>
//字符串逆序函数

int my_strlen(char*str)
{
	int count = 0;
	while (str[count])
	{
		count++;
	}
	return count;
}
void reverse_str(char*str)//用指针的手段字符串实现逆序
{
	assert(str);
	int len = my_strlen(str);//求字符串长度
	char* left = str;
	char* right = str + len - 1;
	while (left < right)
	{
		char tmp = *left;
		*left = *right;
		*right = tmp;
		left++;
		right--;
	}
}
void test()
{
	char arr[] = "noitartsinimda";
	reverse_str(arr);
	printf("%s\n", arr);
}
int main()
{
	test();
	return 0;
}